package com.luoxue.execsql.rest.controller;

import org.jasypt.encryption.StringEncryptor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/stringEncryptor")
public class StringEncryptorController {
    @Resource
    private StringEncryptor stringEncryptor;

    @GetMapping("/encrypt")
    public String encrypt(String str) {
        return stringEncryptor.encrypt(str);
    }

    @GetMapping("/decrypt")
    public String decrypt(String str) {
        return stringEncryptor.decrypt(str);
    }
}
